<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import emitter from '../utils/emitter.js'

const isSidebarOpen = ref(true)
const toggleSidebar = () => {
  isSidebarOpen.value =!isSidebarOpen.value
}
onMounted(() => {
  emitter.on('toggle-sidebar', toggleSidebar)
})
onUnmounted(() => {
  emitter.off('toggle-sidebar')
})
</script>

<template>
  <main
      :class="{ 'ml-48' : isSidebarOpen , 'ml-14' :!isSidebarOpen }"
      class="h-[calc(100vh-64px)] bg-white overflow-hidden transition-all duration-300 ease-in-out">
    <div class="content-box bg-slate-100 h-full w-full p-5 border-tl rounded-tl-[30px] overflow-auto">
      <h1 class="text-5xl font-bold text-blue-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-indigo-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-green-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-red-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-orange-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-yellow-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-purple-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-pink-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-gray-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-slate-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-zinc-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-neutral-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-stone-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-amber-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-lime-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-emerald-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-teal-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-sky-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-violet-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-fuchsia-500">Welcome to the my blog website!</h1>
      <h1 class="text-5xl font-bold text-rose-500">Welcome to the my blog website!</h1>
    </div>
  </main>
</template>

<style scoped>
.content-box {
  box-shadow: inset 0 3px 4px #0000001a;
}
</style>
